<?php
require './include/global.php';
require './include/validate.php';
require './include/all_left.php';

require_once './include/advisory_db.php';
//print_r($_SESSION);
$smarty->compile_check = true;

$smarty->display('header.tpl');
$jid   = trim($_GET[jid]);
$smarty->assign("view",$_GET[view]);

//edit()
if($_GET[rid]){
	$sql = "SELECT * FROM pa_resume WHERE rc_id = '".$_GET[rid]."' ";
	$editresume = $DB->fetch_one_array($sql);
	$jid = $editresume[rc_aliasid];
}


$smarty->assign('jid',$jid);

$sql    = "SELECT * FROM pa_job WHERE jo_id = '".$jid."'";
//echo $sql;
$jobarr = $DB->fetch_one_array($sql);
if($jobarr[jo_uid]==$_SESSION[uid] || $jobarr['jo_status'] != 1 ){
   $err = "Invalid ID! 1. It's your posted job. 2. Job status is Closed or On Hold";
   $smarty->assign("err",$err);
   $smarty->display("left.tpl");
   $smarty->display("error.tpl");
   $smarty->display("right.tpl");
   $smarty->display('footer.tpl');
   exit;
}
//print_r($jobarr);
if($jobarr[jo_updtime]=='0') $jobarr[jo_updtime] = $jobarr[jo_regtime];
$jobarr[jo_updtime] = date("m/d/Y",$jobarr[jo_updtime]);
$jobarr[jo_regtime] = date("m/d/Y",$jobarr[jo_regtime]);
$jobarr[jo_status]  = $jobfillstatus[$jobarr[jo_status]];

$smarty->assign("jobarr",$jobarr);
$smarty->assign("fee_options",$fee_options);
//preview
if($_POST[preview] == " Preview "){
	$_POST[rc_detail] = HTMLENTITIES($_POST[rc_detail]);
	$smarty->assign('s',$_POST);
	$smarty->assign("view",1);
	$editresume = $_POST;
}else{
		include ("./check/resumepostcontact.php");
		if(empty($_POST) && empty($editresume)){

			$list = $DB->fetch_one_array("SELECT * FROM pa_recuiter WHERE rc_id ='" . $_SESSION[uid]."'");
			
			$list[rc_recruitex] = $yearexp2[$list[rc_recruitex]];
			
			$smarty->assign('s',$list);

		}elseif(!empty($editresume)){
			$smarty->assign('s',$editresume);
			$smarty->assign("editid",$editresume[rc_id]);
		}else{
			$_POST[rc_detail] = HTMLENTITIES($_POST[rc_detail]);
			$smarty->assign('s',$_POST);
		}
}

if($_GET[country]==''){
$_GET[country] = 211;
}

//jobupdate
$smarty->assign('jobupdate_names',$UPDATE);
$smarty->assign('state',$state);
$smarty->assign('country',$country);
$smarty->assign('education',$education);
$smarty->assign('yearexp2',$yearexp2);

$smarty->assign("stateView",$state[$editresume[rc_state]]);
$smarty->assign("countryView",$country[$editresume[rc_country]]);
$smarty->assign("rc_yearexpView",$yearexp2[$editresume[rc_yearexp]]);
$smarty->assign("rc_mgmtView", $yearexp2[$editresume[rc_mgmt]]);
$smarty->assign("degreeView",  $education[$editresume[rc_edulevel]]);

$smarty->assign('industry',$jobcategory);
$smarty->assign('function',$jobfunction);
$smarty->assign('salary',$salary);
$smarty->assign('jobtype',$jobtype);
$smarty->assign('rec_findapplicant',$all_submitapplicant);
//only resumeid


if ($err != '')
{
	$smarty->assign("err", $err);
}

$smarty->display('allleft.tpl');
$smarty->display('resumecontactemployer.tpl');
$smarty->display('footer.tpl');
?>